#pragma once
#include "tlm.h"                                // TLM headers
#include "tlm_utils/simple_target_socket.h"
#include <iostream>
#include <string.h>
#include "systemc.h"
#include "tlmModule.hpp"

typedef uint64_t Addr;
using namespace std;
using namespace sc_core;
using namespace tlm;
using namespace sc_dt;
using namespace cw;

class TargetSocket:  public sc_module  {

  public:
    void  custom_b_transport(tlm_generic_payload &payload, sc_time &delay_time);
    bool checkAddressRange ( Addr address, Addr bytes);
    bool checkPayloadAddress (tlm_generic_payload &gp);
    Uns32 debug_transport (tlm_generic_payload &payload);

    TargetSocket ( tlmModule  &parent,  sc_module_name  module_name,  Addr high_address);

  public:
    tlm_utils::simple_target_socket<TargetSocket>  socket;
    Addr maxAddress;
    uint8_t *addr8Block;
    uint16_t *addr16Block;
    uint32_t *addr32Block;
    struct {
        Addr address;
        Uns32 bytes; 
    } gpayload;
    sc_event data_ready;
};